package com.wangjw.coreTechnology;

import java.util.concurrent.atomic.AtomicLongFieldUpdater;

/**
 * Created by wangjw on 18/7/16.
 */
public class CompactCounter {

    private volatile long counter;

    private static final AtomicLongFieldUpdater<CompactCounter> updater
            = AtomicLongFieldUpdater.newUpdater(CompactCounter.class, "counter");

    public void increase() {
        updater.incrementAndGet(this);
    }
}
